package infb.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name = "CATEGORIAS_MEDICAMENTOS")
@NamedQueries({@NamedQuery(name = "CategoriasMedicamentos.findAll", query = "SELECT c FROM CategoriasMedicamentos c"), @NamedQuery(name = "CategoriasMedicamentos.findById", query = "SELECT c FROM CategoriasMedicamentos c WHERE c.id = :id"), @NamedQuery(name = "CategoriasMedicamentos.findByCategoria", query = "SELECT c FROM CategoriasMedicamentos c WHERE c.categoria = :categoria")})
@SequenceGenerator(name="secuencia_cat_medicamentos",sequenceName="SECUENCIA_CAT_MEDICAMENTOS",allocationSize=1)
public class CategoriasMedicamentos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="secuencia_cat_medicamentos")
    private Short id;
    @Basic(optional = false)
    @Column(name = "CATEGORIA")
    private String categoria;

    public CategoriasMedicamentos() {
    }

    public CategoriasMedicamentos(Short id) {
        this.id = id;
    }

    public CategoriasMedicamentos(Short id, String categoria) {
        this.id = id;
        this.categoria = categoria;
    }

    public Short getId() {
        return id;
    }

    public void setId(Short id) {
        this.id = id;
    }

    public String getCategoria() {
        return categoria;
    }

    public void setCategoria(String categoria) {
        this.categoria = categoria;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriasMedicamentos)) {
            return false;
        }
        CategoriasMedicamentos other = (CategoriasMedicamentos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "infb.modelo.CategoriasMedicamentos[id=" + id + "]";
    }

}
